//
//  AccuracyView.m
//  兼职页面
//
//  Created by kuiyuan liang on 2021/5/23.
//

#import "AccuracyView.h"
#import "CommonUtil.h"

@interface AccuracyView()

@property (strong, nonatomic) UILabel * leftLabel;
@property (strong, nonatomic) UIView * rightView;
@property (strong, nonatomic) UIView * indexView;

@end

@implementation AccuracyView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
       
        [self addSubview:self.leftLabel];
        [self addSubview:self.rightView];
        [self.rightView addSubview:self.indexView];
    }
    return self;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    self.rightView.width = self.width - self.leftLabel.right - AD(10);
    self.indexView.width = self.rightView.width * 0.25;
}


#pragma mark - lazy
-(UILabel *)leftLabel{
    if (!_leftLabel) {
        _leftLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, AD(80), self.height)];
        _leftLabel.textColor = [UIColor blackColor];
        _leftLabel.font = [UIFont  systemFontOfSize:AD(11)];
        _leftLabel.text = @"正确率 25%";
        _leftLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _leftLabel;
}

-(UIView *)rightView{
    if (!_rightView) {
        _rightView = [[UIView alloc] initWithFrame:CGRectMake(_leftLabel.right, 0, 0, self.height)];
        _rightView.layer.cornerRadius = AD(3);
        _rightView.layer.borderWidth = AD(1);
        _rightView.layer.borderColor = RGB(255.0, 89.0, 117.0).CGColor;
    }
    return _rightView;
}

-(UIView *)indexView{
    if (!_indexView) {
        _indexView = [[UIView alloc] initWithFrame:CGRectMake(AD(3), AD(2), AD(100), self.rightView.height - AD(4))];
        _indexView.backgroundColor = RGB(255.0, 89.0, 117.0);
        _indexView.layer.cornerRadius = AD(3);
    }
    return _indexView;
}

@end
